<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 手写map方法
        Array.prototype.myMap = function (fn, context) {
            let temp = []
            for (let i = 0; i < this.length; i++) {
                temp.push(fn.call(context, this[i], i, this))
            }
            return temp
        }
        arr1 = [1, 2, 3, 4]
        arr1.myMap((item, index, array) => {
            item+=1
        })

    </script>
</body>

</html>